
function createXMLHttpRequest() {
	var XMLHttp = 
	[
		function () {return new XMLHttpRequest();},
		function () {return new ActiveXObject("Msxml2.XMLHTTP");},
		function () {return new ActiveXObject("Msxml3.XMLHTTP");},
		function () {return new ActiveXObject("Microsoft.XMLHTTP");}
	];

	var xmlhttp = false;

	for(var i=0;i<XMLHttp.length;i++){
		try{
			xmlhttp = XMLHttp[i]();
		}
		catch(e){
			continue;
		}
		break;
		
	}
	return xmlhttp;
}


function request(url,callback,data){
	var xmlhttp = createXMLHttpRequest();
	if(!xmlhttp) return false;
	var method = (data) ? "POST" : "GET";
	xmlhttp.open(method,url,true);
	xmlhttp.setRequestHeader('User-Agent','XMLHTTP/1.0');
	xmlhttp.setRequestHeader('Content-type','application/x-www-from-urlencoded');
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState != 4) return false;
		if(xmlhttp.status != 200 && xmlhttp.status != 304){
			alert("赞失败！"+xmlhttp.status);
			return false;
		}
		callback(xmlhttp);
	}
	//if(xmlhttp.readyState == 4) return true;
	xmlhttp.send(data);
}

function callback(xmlhttp){
	var res = xmlhttp.responseText;
}

function zan(){
	var z = document.getElementById('zan_count');
	var c = parseInt(z.innerHTML);
	z.innerHTML = c+1;
	var url = "index.php?zan=111";
	var callback = "";
	var data = "zan=1";
	request(url,callback,data);
	alert('thanks!');
}
